﻿using System.Collections.Generic;
using System.Data;
using DbMetadata.Providers;

namespace DbMetadata
{
    /// <summary>
    /// Represents a class that is capable of extracting metadata information from a database.
    /// </summary>
    public interface IDbMetadataExtractor
    {
        /// <summary>
        /// Returns a list of <see cref="TableInfo"/> instances.
        /// </summary>
        /// <returns>A <see cref="IEnumerable{T}"/> that contains <see cref="TableInfo"/> instances.</returns>
        IEnumerable<TableInfo> ReadTables();

        /// <summary>
        /// Returns a list of <see cref="ColumnInfo"/> instances.
        /// </summary>
        /// <returns>A <see cref="IEnumerable{T}"/> that contains <see cref="ColumnInfo"/> instances.</returns>
        IEnumerable<ColumnInfo> ReadColumns();

        /// <summary>
        /// Returns a list of <see cref="ForeignKeyInfo"/> instances.
        /// </summary>
        /// <returns>A <see cref="IEnumerable{T}"/> that contains <see cref="ForeignKeyInfo"/> instances.</returns>
        IEnumerable<ForeignKeyInfo> ReadForeignKeys();

        /// <summary>
        /// Returns a list of <see cref="PrimaryKeyInfo"/> instances.
        /// </summary>
        /// <returns>A <see cref="IEnumerable{T}"/> that contains <see cref="PrimaryKeyInfo"/> instances.</returns>
        IEnumerable<PrimaryKeyInfo> ReadPrimaryKeys();

        /// <summary>
        /// Gets or sets the <see cref="IDbConnection"/> instance that is used to retrieve database metadata.
        /// </summary>
        IDbConnection DbConnection { get; set; }
    }
}
